
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int res = 0;
	int arr[] = {3, 2, 0, 2, -1};
	for(int i=12345678; i<=98765432; i++)
	{
		int tmp = i;
		int k = 0;
		while(tmp)
		{
			int x = tmp%10;
			if(x == arr[k])
				k+=1;
			tmp /= 10;
		}
		if (arr[k] == -1)
		{
			res++;
		}
	}
	cout << 98765432 - 12345678 - res + 1 << endl;
	return 0;
 } 




 
 
 
 
 
 
 
 
 
 
 